<?php
    class Admin extends Controller{
		private $auth, $db;
		
		public function init(){ 
			$this->auth = new authHelper();
			$this->auth->setLoginControllerAction('admin', 'login');
			$this->auth->checkLogin('redirect');						
			$this->db = new AdminModel();			
		}
		
		public function Index_action(){
		}
		
		public function login(){
			if( $this->getParam('acao') ) {
				$this->auth->setTableName('admin')
					 ->setUserColumn('login')
					 ->setPassColumn('senha')
					 ->setUser( $_POST['login'] )
					 ->setPass( md5($_POST['senha']) )
					 ->setLoginControllerAction('admin', 'index')
					 ->login();
			}
			
			$this->view('login');
		}
		
		public function logout(){
			$this->auth ->setLogoutControllerAction('index', 'index')
						->logout();
		}
    }